#coding=utf-8

from aip import AipOcr

""" 你的 APPID AK SK """
APP_ID = '17089597'
API_KEY = '9BnA4MS2ytN9bcoULAR8dQ45'
SECRET_KEY = 'GuzAEpvhaAAwox6ikq5uwgBweZ5eaPpE'

client = AipOcr(APP_ID, API_KEY, SECRET_KEY)

""" 读取图片 """
def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()

image = get_file_content('as.png')

""" 如果有可选参数 """
options = {}
options["language_type"] = "CHN_ENG"
options["detect_direction"] = "true"
options["detect_language"] = "true"
options["probability"] = "true"

""" 带参数调用通用文字识别, 图片参数为本地图片 """
result = client.basicGeneral(image, options)

print result